package com.gupao.observerdemo.observer.mouse;

import com.gupao.observerdemo.observer.core.Event;

import java.lang.reflect.Method;

public class MouseTest {
    public static void main(String[] args) {

        //被观察者
        Mouse mouse = new Mouse();
        //观察者
        MouseEventCallBack callBack = new MouseEventCallBack();
        try {
            Method call = callBack.getClass().getMethod("onClick", Event.class);
            mouse.addListener(MouseEventType.ON_CLICK,callBack,call);
            mouse.click();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }



    }
}
